

use "$data/clean/clean_main_complete.dta" , replace
 
		   
loc experiments " any_doors  doors_wins z_score_fs"

		   
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' `experiments'  {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore



loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */



 
********************************Panel B*****************************************
	
 xi: reg `choice'  voice_instrumental voice_intrinsic voice_feedback_intrinsic voice_feedback_instrumental  , vce(r) // 
   
   
    sigstar voice_instrumental   , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
    sigstar voice_feedback_instrumental , prec(3)
    estadd loc thisstat6 = "`r(bstar)'": col`colnum'
    estadd loc thisstat7 = "`r(sestar)'": col`colnum'
	
	sigstar  voice_intrinsic , prec(3)
    estadd loc thisstat9 = "`r(bstar)'": col`colnum'
    estadd loc thisstat10 = "`r(sestar)'": col`colnum'
		
	sigstar voice_feedback_intrinsic , prec(3)
    estadd loc thisstat12 = "`r(bstar)'": col`colnum'
    estadd loc thisstat13 = "`r(sestar)'": col`colnum'

		
		 
	qui sum `choice' if control==1
	estadd loc thisstat15 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat16 = string(`r(N)', "%9.0f"): col`colnum'
	
	
	
    loc ++colnum

	
	
	 
 xi: reg `choice'  voice_instrumental voice_intrinsic voice_feedback_intrinsic voice_feedback_instrumental $control , vce(r) // 
   
   
    sigstar voice_instrumental   , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
    sigstar voice_feedback_instrumental , prec(3)
    estadd loc thisstat6 = "`r(bstar)'": col`colnum'
    estadd loc thisstat7 = "`r(sestar)'": col`colnum'
	
	sigstar  voice_intrinsic , prec(3)
    estadd loc thisstat9 = "`r(bstar)'": col`colnum'
    estadd loc thisstat10 = "`r(sestar)'": col`colnum'
		
	sigstar voice_feedback_intrinsic , prec(3)
    estadd loc thisstat12 = "`r(bstar)'": col`colnum'
    estadd loc thisstat13 = "`r(sestar)'": col`colnum'

		
		 
	qui sum `choice' if control==1
	estadd loc thisstat15 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat16 = string(`r(N)', "%9.0f"): col`colnum'
	
		
	estadd loc thisstat17 = "X" : col`colnum'
	
	
    loc ++colnum


	}
	

	 

loc rowlabels " " " "  " "Treatment: instrumental" " " " "  "Treatment: instrumental + feedback" " " " " "Treatment: intrinsic" " " " "  "Treatment: intrinsic + feedback" " " " "  "Control mean" "Number of Observations" "Controls" "

loc rowstats ""

forval i = 1/17 {
    loc rowstats "`rowstats' thisstat`i'"
}



esttab col* using "$output/treat_doors_fs_detailed.tex", replace cells(none) booktabs nonotes  compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
 mtitle("Any" "Any" "Doors (wins)" "Doors (wins)"  "Voice index (z)" "Voice index (z)") mgroups("App data" "Survey data",  pattern(1 0 0 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


